<template>
  <view class="page">
    <view class="content flex">
      <view class="word flex-1">{{ schoolData.name }}</view>
      <view class="mean"
        >{{ schoolData.area }}
        <text class="ml-20">{{ schoolData.competentDepartmentName }} </text>
      </view>
      <!-- <u-icon name="arrow-right" style=""></u-icon> -->
    </view>

    <view class="content">
      <view class="item d_flex_b" @click="">
        <view class="word"
          >{{
            (qrySpecialtyData.code || "") + "-" + (qrySpecialtyData?.name || "")
          }}
        </view>
      </view>
    </view>
    <!-- <u-sticky bgColor="#fff">
        <u-tabs :list="list1"></u-tabs>
      </u-sticky> -->
    <view class="content">
      <view class="tab-item mb-10">专业信息</view>
      <view class="spec-item"
        ><view>所属门类</view><view>{{ qrySpecialtyData.oname }}</view>
      </view>
      <view class="spec-item"
        ><view>所属专业类</view><view>{{ qrySpecialtyData.pname }}</view>
      </view>
    </view>
    <view class="content">
      <view class="tab-item mb-10">招生信息</view>
      <view class="spec-item"
        ><view>计划招生人数</view
        ><view>{{ qryAdmissionList[0]?.planNum }}</view>
      </view>
      <!-- <view class="spec-item"
        ><view>来源专业</view
        ><view>{{ qryAdmissionList[0]?.sourceSpecialtyNames[0] }}</view>
      </view> -->
      <view
        class="spec-item text-22"
        v-for="(item, index) in qryBrochList"
        :key="index"
        @click="toschoolGuide(item)"
        >{{ `[${item.year}]${item.name || ""}` }}
      </view>
    </view>
    <view class="content">
      <view class="tab-item mb-10">考试信息</view>
      <uni-table border stripe emptyText="暂无更多数据">
        <uni-tr>
          <uni-th width="100rpx" align="center">年份</uni-th>
          <uni-th width="110rpx" align="center">考试科目</uni-th>
          <uni-th width="140rpx" align="center">考试大纲</uni-th>
          <uni-th width="110rpx" align="center">参考教材</uni-th>
        </uni-tr>
        <template v-for="(item, index) in qryExamData" :key="index">
          <uni-tr>
            <uni-td align="center">{{ item.year }}</uni-td>
            <uni-td align="center">{{ item.subjectName }}</uni-td>
            <uni-td align="center">{{ item.name }}</uni-td>
            <uni-td align="center"
              ><view
                class="mr-8"
                v-for="(item1, index1) in item.booksList"
                :key="index1"
                >{{ item1.title }}</view
              >
            </uni-td>
          </uni-tr>
        </template>
      </uni-table>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      navList: [],
      qryAdmissionList: [],
      qryBrochList: [],
      curNav: 0,
      schoolCode: "",
      specialtyId: "",
      schoolData: {},
      qryExamData: {},
      qrySpecialtyData: {},
      size: 10,
      current: 1,
      list1: [{ name: "招生详情" }, { name: "参考教材" }, { name: "分数线" }],
      total: 10,
    };
  },
  onLoad(options) {
    this.schoolCode = options.schoolCode || "1231242134";
    this.specialtyId = options.specialtyId || "";
    this.getList();
    this.qryExamList();
    this.qrySpecialtyDe();
    this.qryAdmissionPlanList();
    this.qryBrochuresList();
  },
  onShow() {},
  onReachBottom() {},
  methods: {
    changeNav(i) {
      this.curNav = i;
    },
    toStart(item) {
      // uni.navigateTo({
      //   url: "/pages/special/specialList" + "?schoolCode=" + this.schoolCode,
      // });
    },
    toschoolGuide(item) {
      var content = item.content;
      // console.log("content=", content);
      uni.navigateTo({
        url: "/pages/special/schoolGuide" + "?content=" + encodeURIComponent(content),
      });
    },

    getList() {
      this.$http
        .get1("/client/undergraduate/schoolDetail", {
          schoolCode: this.schoolCode,
          examType: 12,
        })
        .then((res) => {
          if (res.code == 200) {
            this.schoolData = res.data;
          }
        });
    },
    qryExamList() {
      this.$http
        .get1("/client/undergraduate/qryExamSyllabus", {
          schoolCode: this.schoolCode,
          specialtyId: this.specialtyId,
          examType: 12,
        })
        .then((res) => {
          // console.log(res);
          if (res.code == 200) {
            this.qryExamData = res.data;
          }
        });
    },
    qrySpecialtyDe() {
      this.$http
        .get1("/client/undergraduate/qrySpecialtyDetail", {
          id: this.specialtyId,
          examType: 12,
        })
        .then((res) => {
          // console.log(res);
          if (res.code == 200) {
            this.qrySpecialtyData = res.data;
          }
        });
    },
    // 获取专升本学校招生计划列表
    qryAdmissionPlanList() {
      this.$http
        .get1("/client/undergraduate/qryAdmissionPlan", {
          schoolCode: this.schoolCode,
          specialtyIds: this.specialtyId + "",
          examType: 12,
        })
        .then((res) => {
          if (res.code == 200) {
            this.qryAdmissionList = res.data;
          }
        });
    },
    // 获取专升本学校招生简章
    qryBrochuresList() {
      this.$http
        .get1("/client/undergraduate/qryBrochures", {
          schoolCode: this.schoolCode,
          examType: 12,
        })
        .then((res) => {
          // console.log(res);
          if (res.code == 200) {
            this.qryBrochList = res.data;
          }
        });
    },
  },
};
</script>

<style lang="scss">
page {
  background-color: #f2f3f8;
}
.page {
  padding: 40rpx 30rpx 200rpx;
  box-sizing: border-box;
}

.content {
  width: 100%;
  min-height: 100rpx;
  background: #ffffff;
  box-shadow: 0rpx 4rpx 8rpx 2rpx rgba(42, 65, 152, 0.05);
  border-radius: 20rpx;
  margin-bottom: 20rpx;
  padding: 30rpx 30rpx;
  box-sizing: border-box;
  .word {
    font-size: 30rpx;
    font-weight: bold;
    color: #333333;
  }
  .word-item {
    background-color: #5480f8;
    border-radius: 10rpx;
    margin-right: 12rpx;
    font-size: 24rpx;
    font-weight: 400;
    padding: 4rpx 10rpx;
    margin-top: 10rpx;
  }
  .mean {
    margin-left: 0rpx;

    font-size: 24rpx;
    color: #575a64;
  }

  .tab-item {
    // background-color: #5480f8;
    // border-radius: 10rpx;
    font-size: 28rpx;
    font-weight: 400;
    padding: 2rpx 20rpx;
    // color: #ffffff;
    border-left: 8rpx solid #5480f8;
  }
  .spec-item {
    display: flex;
    justify-content: space-between;
    font-size: 24rpx;
  }
  .guide-item {
    padding: 4rpx 0rpx;
  }

  ::v-deep .uni-table-th {
    font-size: 22rpx;
  }
  ::v-deep .uni-table-td {
    font-size: 22rpx;
  }
}
.page-btn {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 176rpx;
  padding: 30rpx 62rpx;
  box-sizing: border-box;
  background-color: #fff;
  z-index: 10;
  .btn {
    width: 100%;
    height: 90rpx;
    background: #5480f8;
    border-radius: 46rpx;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32rpx;
    font-weight: 500;
    color: #ffffff;
    &.disable {
      background-color: #cad8fc;
    }
  }
}
</style>
